package d0318;

import java.util.Date;

public class LianXi extends Thread {
private String name;
        public LianXi(String name){
            this.name=name;
        }

        public synchronized void run() {
            System.out.println (name+"线程开始于"+new Date());
            try {
                Thread.sleep(3000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println (name+"线程结束于"+new Date());
        }

    public static void main(String[] args) {
        LianXi t1 = new LianXi("t1");
        t1.start();
    }
    }


